package models

// command constants.
const (
	CmdBotHelper   = iota // Command to output help text.
	CmdBotManual          // Command to output the manual web link address.
	CmdBotFeatures        // Command to output syntax features of the bot recently.
	CmdBotFeedback        // Command to receive user feedback.

	CmdRoomInfo    // Command to output the information of the live room.
	CmdRoomAdmin   // Command to output all the admins of the live room.
	CmdRoomStats   // Command to output the statistics of the live room that bot recorded.
	CmdRoomBgImage // Command to output the link address of the live room background image.
	CmdTextBoard   // Command to choice a text board according to the arguments and send it.
	CmdNickname    // Command to set nickname for a particular user, it will be displayed at welcome message from the bot.
	CmdWhoami      // Command to output the user's information.
	CmdCheckin     // Command to do user-checkin action.
	CmdCheckinRank // Command to output today's ranking of checkin users.
	CmdSlackOff
	CmdHoroscope
	CmdWeather
	CmdTiangou

	CmdModeAll    // Command to output all the mode values.
	CmdModeMute   // Switch the mute mode on/off.
	CmdModePander // Switch the pander text sender task on/off.
	CmdModePinyin // Switch the pinyin module on/off.
	CmdModeNoble  // Switch the user noble showing module on/off.
	CmdModeMedal  // Switch the user medal showing module on/off.
	CmdModeWater  // Switch the drinking reminder task on/off.

	CmdSongReq   // Command to add a song to the songs list.
	CmdSongList  // Command to output the songs list, only take the first ten songs.
	CmdSongDone  // Command to remove one or more songs out of the songs list.
	CmdSongClear // Command to clear the songs list.

	CmdPiaStart
	CmdPiaNext
	CmdPiaStop

	CmdRollDice // Command to roll ASCII dice.
	CmdChar     // Command to send a Chinese character.
	CmdLove     // Command for testing, the bot is started if output correctly.
)

const (
	RoleBigBrother = iota
	RoleSupervisor // Sames to RoleCreator.
	RoleCreator    // The live room creator.
	RoleAdmin      // The live room admin.
	RoleMember
)

type Command struct {
	*Room
	Raw    string
	Args   []string // exclude command
	User   FmUser
	Info   FmInfo
	Role   int
	Output chan<- string
}

var _cmdMap = map[string]int{
	// Bot commands.
	"帮助":       CmdBotHelper,
	"help":     CmdBotHelper,
	"说明书":      CmdBotManual,
	"manual":   CmdBotManual,
	"更新":       CmdBotFeatures,
	"feat":     CmdBotFeatures,
	"反馈":       CmdBotFeedback,
	"feedback": CmdBotFeedback,
	// Room-related commands.
	"房间":    CmdRoomInfo,
	"直播间":   CmdRoomInfo,
	"room":  CmdRoomInfo,
	"info":  CmdRoomInfo,
	"管理员":   CmdRoomAdmin,
	"admin": CmdRoomAdmin,
	"统计数据":  CmdRoomStats,
	"stats": CmdRoomStats,
	"背景图":   CmdRoomBgImage,
	"bg":    CmdRoomBgImage,
	"灯牌":    CmdTextBoard,
	"board": CmdTextBoard,
	"dp":    CmdTextBoard,
	// Common commands.
	"昵称":       CmdNickname,
	"nic":      CmdNickname,
	"我是谁":      CmdWhoami,
	"whoami":   CmdWhoami,
	"签到":       CmdCheckin,
	"打卡":       CmdCheckin,
	"dd":       CmdCheckin,
	"checkin":  CmdCheckin,
	"签到榜":      CmdCheckinRank,
	"摸鱼":       CmdSlackOff,
	"slackoff": CmdSlackOff,
	"星座":       CmdHoroscope,
	"天气":       CmdWeather,
	"日记":       CmdTiangou,
	// Playlist commands.
	"点歌":    CmdSongReq,
	"req":   CmdSongReq,
	"歌单":    CmdSongList,
	"list":  CmdSongList,
	"完成":    CmdSongDone,
	"done":  CmdSongDone,
	"清空":    CmdSongClear,
	"clear": CmdSongClear,
	// Drama commands, no English version.
	"贴本": CmdPiaStart,
	"选本": CmdPiaStart,
	"n":  CmdPiaNext,
	"结束": CmdPiaStop,
	// Hidden commands.
	"骰子":   CmdRollDice,
	"色子":   CmdRollDice,
	"die":  CmdRollDice,
	"dice": CmdRollDice,
	"字符":   CmdChar,
	"char": CmdChar,
	"比心":   CmdLove,
	"笔芯":   CmdLove,
	"love": CmdLove,
	// Mode switch commands.
	"模式":     CmdModeAll,
	"mode":   CmdModeAll,
	"静音":     CmdModeMute,
	"mute":   CmdModeMute,
	"显示拼音":   CmdModePinyin,
	"pinyin": CmdModePinyin,
	"显示贵族":   CmdModeNoble,
	"noble":  CmdModeNoble,
	"显示粉丝牌":  CmdModeMedal,
	"medal":  CmdModeMedal,
	"喝水助手":   CmdModeWater,
	"water":  CmdModeWater,
	"咳咳":     CmdModePander,
	"彩虹屁":    CmdModePander,
	"pander": CmdModePander,
}

// Cmd use key to get command constant.
func Cmd(key string) int {
	if v, ok := _cmdMap[key]; ok {
		return v
	}
	return -1
}
